particles diffusion

Modified from original

File:
Export:
Mode: Interactive
Commands and Code: Bottom
Created with Highcharts 10.3.1x-coordinateFrequency ofparticlesChart context menuX distribution of particles-40-30-20-1001020304005001000

WHAT IS IT?

This is a model of particles diffusing in a chamber. This model is meant to be used as a tool to generate and test basic intuitions about using random walk to simulate diffusion of particles.

HOW IT WORKS

At every time step (tick), a particle changes its direction randomly from 0 to 259 degrees. It takes a step forward through a randomly chosen fractional distance of less than 1 unit. The distance and time units are arbitrary. The distance unit is the same as a unit of distance in the XY plane.

The 2D space is set up such that it wraps around along the Y dimension and ends along the X dimension. Topologically it can be imagined as the surface of a cylinder.

There is a blue line that represents a membrane that separates two chambers.

If a particle runs into the membrane or is about to cross the edge in the X direction, it turns around by 180 degrees. If a particle crosses the edge in the Y direction, it appears on the opposite side in the Y direction.

HOW TO USE IT

You can set the "number-of-particles" and turn the "trace-path?" switch ON or OFF.

The "trace-path?" switch is useful for viewing the history of particles' paths when the particle number is low.

Run the model to see how diffusion can be modeled using a simple random walk procedure.

THINGS TO NOTICE

One can observe the change in the concentration of particles in a 2D plane along X and Y dimensions.

The graph shows a histogram of the distribution of particles along the X dimension. Notice how the distribution changes over time. Will it theoretically ever become uniform?

THINGS TO TRY

Change the number of particles and see if the time-dependence on the change in the distribution in the X dimension changes.

Read the code. Try changing the sequence of steps in the procedures random walk. Why is the sequence important?

EXTENDING THE MODEL

Change the permeability of the membrane such that it becomes probabilistically semi-permeable. In other words, modify the code so that particles can cross the membrane with some probability. Try adding a slider so that you can set this probability.
Is it biologically meaningful to model semi-permeability like this?

Advanced: 1. Think about how you can make the movement of particles more realistic for different environments, such as in air or in a fluid outside a neuron. 2. Change how the two/three dimensional space is organized and see if that has any effect on using the random walk to simulate diffusion.

CREDITS AND REFERENCES

The model was created by Sugat Dabholkar for a course that was taught in collaboration with Mehrab Modi.